<template>
	<view class="p24">
		<u-form :model="form" ref="uForm" labelWidth="auto" :clearable="false" :borderBottom="false">
			<view class="fs30  ml20 relative mb22">
				<text>请上传营业执照</text>
				<u-image width="6" height="20" src="/static/img/order/title.png"
					style="position: absolute;left: -20rpx;top: 0rpx;"></u-image>
			</view>

			<view class="pl20 pr20  bg-fff radius12 mb22 ">
				<u-form-item  prop="license">
					<view class="flex row-center flex1">
						<imgList @success="ids=>form.license=ids" width="574" height="272"
							:src="'/static/img/index/jigou.png'" />
					</view>
				</u-form-item>
			</view>
			
			<view class="fs30 ml20 relative mb22">
				<text>请填写认证资料</text>
				<u-image width="6" height="20" src="/static/img/order/title.png"
					style="position: absolute;left: -20rpx;top: 0rpx;"></u-image>
			</view>
			<view class="pl20 pr20  bg-fff radius12 mb22 ">
				<u-form-item label="机构名称" prop="name">
					<u-input v-model="form.name" inputAlign="right" :clearable="false"
						placeholder="请输入机构名称" />
				</u-form-item>
			</view>
			<view class="pl20 pr20  bg-fff radius12 mb22 ">
				<u-form-item label="统一社会信用代码" prop="credit_code">
					<u-input v-model="form.credit_code" inputAlign="right"
						:clearable="false" placeholder="请输入统一社会信用代码" />
				</u-form-item>
			</view>
			<view class="pl20 pr20  bg-fff radius12 mb22 ">
				<u-form-item label="法定代表人" prop="legal_person">
					<u-input v-model="form.legal_person" inputAlign="right"
						:clearable="false" placeholder="请输入法定代表人" />
				</u-form-item>
			</view>
			<view class="pl20 pr20  bg-fff radius12 mb22 ">
				<u-form-item label="联系方式" prop="mobile">
					<u-input v-model="form.mobile" type="number" maxlength="11" inputAlign="right" :clearable="false"
						placeholder="请输入联系方式" />
				</u-form-item>
			</view>
			<view class="pl20 pr20  bg-fff radius12 mb22 ">
				<u-form-item label="单位地址" prop="address">
					<u-input v-model="form.address" inputAlign="right" :clearable="false" placeholder="请输入单位地址" />
				</u-form-item>
			</view>

			<view class="pl20 pr20  bg-fff radius12 mb22 ">
				<u-form-item label="陪诊项目" >
					<u-input :value="servicesName" @click="getHospital()" disabled inputAlign="right" :clearable="false"
						placeholder="请选择陪诊项目" />
					<u-icon name="arrow-right" @click="getHospital()" />
				</u-form-item>
			</view>


			<view class="h120"></view>
			<view class="pf bottom0 left0  w-max flex">
				<view class="p24 flex1">
					<u-button type="warning" ripple @click="submit">立即认证</u-button>
				</view>
			</view>
		</u-form>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				form: {
					// organ_id: '', //	整型	非必填	-	-	机构id
					// name: '', //	字符串	必填	-	-	真实姓名
					// card_no: '', //	字符串	必填	-	-	身份证号
					// card_pros: '', //	整型	必填	-	-	身份证正面
					// card_cons: '', //	整型	必填	-	-	身份证反面
					// mobile: '', //	字符串	必填	-	-	手机号
					// services: [], //	数组	必填	-	-	医院项目数组：[['hospital_id':'1','service_id':[1,2,3],['hospital_id':'2','service_id':[1,2,3]]]]
					// service_year: '', //	整型	必填	-	-	护龄
					// address: '', //	字符串	必填	-	-	住址
					// certificate: '', //	字符串	必填	-	-	资格证书（多个用,号隔开）
					// report: '', //	整型	必填	-	-	体检报告

					license: '', //	整型	必填	-	-	营业执照
					name: '', //	字符串	必填	-	-	机构名称
					credit_code: '', //	字符串	必填	-	-	统一社会信用代码
					legal_person: '', //	字符串	必填	-	-	法人姓名
					mobile: '', //	字符串	必填	-	-	联系方式
					address: '', //	字符串	必填	-	-	地址
					services: '', //	数组	必填	-	-	医院项目数组：[['hospital_id':'1','service_id':[1,2,3],['hospital_id':'2','service_id':[1,2,3]]]]
				},
				servicesName: '',
				organShow: false, //机构
				organList: [], //

			}
		},
		onReady() {
			this.$refs.uForm.setRules(this.$list('rules'));
		},
		onLoad() {},
		methods: {
			submit() {
				console.log(this.form)
				this.$refs.uForm.validate(valid => {
					if (!valid) return
					this.$request('/master/auth/organAuth', this.form).then(res => {
						this.$msg(res.msg)
						setTimeout(this.$navBack, 1000)
					})
				});
			},

			//机构end
			getHospital() {
				uni.$off('setDome')
				uni.$off('setDomeName')
				uni.$once('setDome', e => this.form.services = e)
				uni.$once('setDomeName', e => this.servicesName = e)
				this.$u.route('/pages/my/serve/hospitalSel', {
					services: this.form.services && JSON.stringify(this.form.services)
				})
			},
		}
	}
</script>

<style lang="scss">

</style>
